<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var Plane = function(){}
    Plane.prototype.fire = function(){
        console.log('发射普通子弹');
    }

    var MissileDecorator = function(plane) {
        this.plane  = plane;
    }

    MissileDecorator.prototype.fire = function() {
        console.log('第一个fire');
        this.plane.fire();
        console.log('发射导弹');
    }

    var AtomDecorator = function(plane) {
        this.plane = plane;
    }

    AtomDecorator.prototype.fire = function() {
        console.log('第二个fire');
        this.plane.fire();
        console.log('发射原子弹');
    }

    var plane = new Plane();
    plane = new MissileDecorator(plane);
    plane = new AtomDecorator(plane);

    plane.fire();

</script>
</html>